package edu.pku.hawk.controller.detectmonitor;

import edu.pku.hawk.controller.util.Constants;
import edu.pku.hawk.controller.util.MConsumerQueue;
import edu.pku.hawk.controller.util.MQManager;

public class TestListenner2 {

	public static void main(String[] args) {

		MQManager mgr;
		try {
			mgr = new MQManager(Constants.MQServer_Name, Constants.MQServer_Password,
					Constants.MQServer_URL);
			MConsumerQueue queue = mgr.getConsumerQueue(Constants.Ctrl_UI_Proc_QueueName);

			while (true) {
				Object o = queue.getObject();

				try {
					DetectReport report = (DetectReport) o;
					System.out.print(report.detectorId + " " );
					System.out.print(report.lastDoubleValue);
					System.out.print(report.dtctState);
					System.out.println(report.dtctType);
					
				} catch (Exception ex) {
					ex.printStackTrace();
				}
			}

		} catch (Exception ex) {
			ex.printStackTrace();
		}

	}

}
